package cn.bonoon.entities;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;

import cn.bonoon.kernel.support.OperandSupport;
import cn.bonoon.kernel.support.entities.AbstractPersistable;

/**
 * 定义是否朝允许访问一个菜单的权限
 * 
 * @author jackson
 *
 */
@Entity
@Table(name = "t_privilege")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
public class PrivilegeEntity extends AbstractPersistable{

	private static final long serialVersionUID = 4161624163145738512L;

	/** 子系统 */
	@Column(name = "C_MODULEID", length = 100)
	private String moduleId;
	
	/** 频道 */
	@Column(name = "C_CHANNELID", length = 100)
	private String channelId;
	
	/** 该权限对应的在配置文件里定义的菜单的ID */
	@Column(name = "C_MENUID", length = 100)
	private String meunId;
	
	/** 当前的节点是否是无效节点.如果是无效节点,则表明没有操作该菜单的权限 */
	@Column(name = "C_INVALID")
	private boolean invalid;
	
	/**<pre>用于存放操作的权限，权限的默认定义包括：查看、添加、修改、删除、移动等，也可以自定义
	 * 存储的格式为二进制格式：11101001，位置为1表示有操作的权限，0则表示没有该权限，
	 * 存储到数据库时以数字表示
	 * 
	 * 所有权限可以用0xFFFFFF来表示
	 * 00000000({@link OperandSupport})</pre>*/
	@Column(name = "C_ACTIONS")
	private long actions;

	@Column(name = "C_ORDINAL")
	private int ordinal;

	public String getModuleId() {
		return moduleId;
	}

	public void setModuleId(String moduleId) {
		this.moduleId = moduleId;
	}

	public String getChannelId() {
		return channelId;
	}

	public void setChannelId(String channelId) {
		this.channelId = channelId;
	}

	public String getMeunId() {
		return meunId;
	}

	public void setMeunId(String meunId) {
		this.meunId = meunId;
	}

	public boolean isInvalid() {
		return invalid;
	}

	public void setInvalid(boolean invalid) {
		this.invalid = invalid;
	}

	public long getActions() {
		return actions;
	}

	public void setActions(long actions) {
		this.actions = actions;
	}

	public int getOrdinal() {
		return ordinal;
	}

	public void setOrdinal(int ordinal) {
		this.ordinal = ordinal;
	}
}
